#include "ManagerFactory.h"
#include <iostream>

bool ManagerFactory::InitManagers()
{
    bool ret = true;
    for (auto& item : m_managerList)
    {
        ret = item.managerPtr->Init();
        if (!ret)                       // 任务一个服务模块初始化失败都返回false
        {
            break;
        }
    }

    if (ret)
    {
        std::cout << "ManagerFactory::Init() success" << std::endl;
    }
    else
    {
        std::cout << "ManagerFactory::Init() error" << std::endl;
    }
    return ret;
}

void ManagerFactory::DestroyManagers()
{
    for (auto& item : m_managerList)
    {
        item.managerPtr->Destroy();
    }
    m_managerList.clear();
}


// ManagerFactoryPtr MgrFactoryInstance()
// {
//     static ManagerFactoryPtr instance = std::make_shared<ManagerFactory>();
//     return instance;
// }